package com.example.androidkt.second

import com.example.androidkt.first.SingletonKotlin

class MyClass<T>{
    fun method(param:T) : T{
        return param
    }
}

class MyClass1{
    fun <T>method(param:T) : T{
        return param
    }
}

class MyClass2{
    fun <T :Number>method(param:T) : T{
        return param
    }
}

fun <T> T.build(block : T.() -> Unit) : T{
    block
    return this
}

fun main() {


    SingletonKotlin.test().build {

    }

    MyClass1().build {
        val javaTest = JavaTest()
        javaTest.test()
    }

    MyClass2().build {
        SingletonKotlin.test()
    }


    val myClass = MyClass<String>()
    myClass.method("xx")


    val myClass1 = MyClass1()
    val method = myClass1.method(12)

}
